<template>
  <div class="home-container">
    <h1>欢迎来到主页</h1>
    <p>用户名: {{ user?.username }}</p>
    <button @click="handleLogout">登出</button>
  </div>
</template>

<script setup>
defineOptions({ name: 'HomePage' });
import { useAuthStore } from '@/stores/auth';
import { ElMessage } from 'element-plus';

const authStore = useAuthStore();

const handleLogout = () => {
  authStore.logout();
  ElMessage.success('您已成功登出');

};
</script>

<style scoped>
.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
button {
  padding: 8px 16px;
  background-color: #f56c6c;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
button:hover {
  background-color: #ff9999;
}
</style>
